<?php 
	session_start();
	require("connect.php");
?>
<html><!-- InstanceBegin template="/Templates/temp02.dwt.php" codeOutsideHTMLIsLocked="false" -->
<style type="text/css">
<!--
#subcontent {
	position:absolute;
	left:243px;
	top:0px;
	width:706px;
	height:59px;
	z-index:1;
	background-color: #70a972;
}
#subcontent01 {
	position:absolute;
	left:22px;
	top:11px;
	width:287px;
	height:39px;
	font:Tahoma;
	font-size:30px;
	font-weight:600px;
	color:#E8E8E8;
	z-index:1;
}
#subcontent02 {
	position:absolute;
	left:312px;
	top:29px;
	font:Tahoma;
	font-size:18px;
	font-weight:500px;
	color:#E8E8E8;
	width:199px;
	height:25px;
	z-index:2;
}
-->
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="css/product.css" />

<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>
<?php 
function GetQuantity($id){
		$cart = $_SESSION["CART"];
		$quantity=0;
		foreach(array_keys($cart) as $value){
			if($value == $id){
				$quantity = $cart[$id];
				break;
			}
		}
		return $quantity;	
	} 
?>
<div id="wrap">
	<div id="title">
		<div id="title01">
			<span><a href="register.php">Register </a>|<a href="mycart.php"> My Cart </a>|<a href="login.php"> Login </a></span>
		</div>
	</div>
	<div id="header">
		<div id="searchform">
	    	<form action="Templates/search.php">
					<input type="text" name="s" value="" onKeyPress="this.style.backgroundColor='pink'" onBlur="this.style.backgroundColor='white'" onFocus="this.style.backgroundColor='pink'"/>
			</form>
		</div>
	</div>
	<div id="menu">
		<ul>
			<li><a href="index.php">TRANG CHỦ</a></li>
			<li><a href="introduce.php">GIỚI THIỆU</a></li>
			<li><a href="product_view.php">SẢN PHẨM</a></li>
			<li><a href="promotion.php">KHUYẾN MẠI</a></li>			
			<li><a href="tuvan.php">TƯ VẤN THIẾT BỊ</a></li>
			<li><a href="phanhoi.php">PHẢN HỒI</a></li>
		</ul>
   </div>
   <div id="submenu">
   		<div id="submennu01"><a href="#">Uy tín/Chất lượng</a></div>
  </div>
   <div id="center">
   		<div id="left">
			<div id="danhmuc"><a href="product_view.php?catid=0">DANH MỤC SẢN PHẨM</a></div>
			<div id="left01">
			<?php 
						$sql=mysql_query("select * from catagory");
						while($row=mysql_fetch_array($sql))
					{
					    echo "<font color=#F8F8F8>::</font>";
						echo "<a href='product_view.php?catid={$row["catID"]}'>{$row["catName"]}</a><br>";
						echo "<font color=#666633 >-------------------------------</font><br>";
					}
			?>
			</div>
			<div id="giohang">
				<div id="giohang01"><b style="font:Tahoma; font-size:14px; color:#FFFFFF;">GIỎ HÀNG CỦA BẠN</b></div>
			</div>
			<div id="cart">
			  <?php include("cartdetail.php");?></div>
		</div>
		<div id="subcontent">
			<div id="subcontent01">NỘI THẤT CAO CẤP</div>
			<div id="subcontent02">UY TÍN - CHẤT LƯỢNG</div>
		</div>
		<div id="content"><!-- InstanceBeginEditable name="vungsuaduoc" -->
		<table width="100%" border="1" cellspacing="3" cellpadding="3" bordercolor="#CCCCCC">
		<?php $getpid=$_REQUEST["pid"];
    	  $productdetail=mysql_query("select * from product where pID='$getpid' ") or die("loi lay bang product");
		  $j=0;
  	 	  $row=mysql_fetch_array($productdetail) ;
  		?>
  <tr>
    <td colspan="2" height="70" style="font-family:Tahoma; font-size:24px; color:#e8e8e8; text-align:center;" bgcolor="#70a972"><?php echo $row["pName"];?></td>
  </tr>
  <tr>
    <td align="center"><img src="images/<?php echo $row["pImage"];?>"></td>
    <td width="70%" style="font-family:Tahoma; font-size:16px; color:#666666; text-align:left; padding-left:25px;" bgcolor="#e8e8e8"><?php echo $row["pDetail"];?> </td>
  </tr>
  <tr>
    <td align="center" style="font-family:Tahoma; font-size:16px; color:red;" bgcolor="#e8e8e8"><?php  if ($row["pPrice"]!=null){?> 
  	  	  Giá :<?php  echo number_format($row["pPrice"],1,".",",");}?> VNĐ</td>
    <td width="70%" rowspan="3" bgcolor="#e8e8e8" style="font-family:Tahoma; font-size:16px; color:#666666; text-align:left; padding-top:15px; padding-left:25px">
	<?php 
		$sql1 = "select a.maker, a.features, a.colors, a.origin, b.pID from productdetail a, product b where a.pID = b.pID and b.pID={$row["pID"]}";
		$resultdetail = mysql_query($sql1) or die("Loi roi! ".$sql1);
		while($r = mysql_fetch_array($resultdetail)){?>
		Hãng sản xuất: <?php echo $r["maker"];?><br>
		Tính năng:<?php echo $r["features"];?><br>Màu sắc: <?php echo $r["colors"];?><br>Xuất xứ:<?php echo $r["origin"];?><br><br>
	<center><a href="cart.php?action=add&pid=<?php echo $r["pID"];?>"><img src="images/cart.png" border="0" style="text-align:right"></a></center><br><?php }?>
	</td>
  </tr>
  <tr>
    <td align="center" style="font-family:Tahoma; font-size:16px; color:#666666;" bgcolor="#e8e8e8"><?php 
  	  	if ($row["pStatus"]==1) echo"<center><font color=#000000><b>Còn Hàng.</b></font></center>";else echo"<br><center><font color=red><b>Hết Hàng.</b></font></center>"
  	  	?></td>

  </tr>
  <tr>
    <td align="center" style="font-family:Tahoma; font-size:16px; color:#666666;" bgcolor="#e8e8e8">Bảo hành : <?php echo $row["pWarranty"];?> năm<br>
	</td>
  </tr>

</table>

		<!-- InstanceEndEditable --></div>
   </div>
   <div id="footer01">
  		<center><a href="#">Design By H3TL&nbsp;Group3<br> Mọi thông tin chi tiết xin liên hệ: h3tl.itpro@gmail.com</a></center>
  </div>
   
</div>


</body>
<!-- InstanceEnd --></html>
